<?php

/**
 * HrModel short summary.
 *
 * HrModel description.
 * @version 1.0
 * @author Administrator
 */
Namespace Api\Model;
use Think\Model;
class HrModel  extends Model
{
    /**
     * 获取组织视图
     */
    function getOrgView(){
        return M("vorganize"," ","HR_DBCONFIG");
    }
    public function getCityList(){
      $arr = $this->getOrgView()->field("distinct city")->select();
      $arrReturn =array();
      foreach($arr as $row)
      {
          $arrReturn[]=$row["city"];
      }
      return $arrReturn;
    }
    
    public function getSchools($strKeywordCityName,$strOrgIDField,$strOrgNameField)
    {
        $tbl = $this->getOrgView()->field("OrgID as ".$strOrgIDField.",OrgName as ".$strOrgNameField)->where("city='%s'",$strKeywordCityName);
        $arr = $tbl->select();
        return  $arr;
        
    } 
    public function getSchoolName($iSectionID)
    {
        $db =$this->getOrgView();
        $arrOrg =   $db->where("orgid=%d",$iSectionID)->field("OrgName")->find();
        if($arrOrg==null){
            return "";
        }
        return $arrOrg["orgname"];
    }
}
